package com.demo.rmi.ab;

import com.demo.rmi.server.HelloService;
import com.demo.rmi.server.RmiServer;
import com.demo.rmi.server.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

public class PublishRmi {

    private static final Logger logger = LoggerFactory.getLogger(PublishRmi.class);

    public static void main(String[] args) throws RemoteException, MalformedURLException, AlreadyBoundException {
        HelloService helloService = new HelloService();
        LocateRegistry.createRegistry(9999);
        Naming.bind("rmi://localhost:9999/helloRmi/h1",helloService);
        logger.info("服务绑定成功");
    }
}
